package cn.xsly.basic.service.impl;

import cn.xsly.basic.exception.BusinessException;
import cn.xsly.basic.service.IBaiduAiAuditService;
import cn.xsly.basic.util.BaiduAuditUtils;
import org.springframework.stereotype.Service;


@Service
public class BaiduAiAuditServiceImpl implements IBaiduAiAuditService {

    @Override
    public Boolean textAudit(String text) {
        return BaiduAuditUtils.TextCensor(text);
    }

    @Override
    public Boolean imageAudit(String resources) {
       for (String img : resources.split(",")) {
            if (img != null) {
                BaiduAuditUtils.ImgCensor("http://123.207.27.208" + img);
            } else {
                throw new BusinessException("审核失败");
            }
        }
        return true;
    }
}
